<script setup lang="ts">
import { useRouter } from 'vue-router'
import { House, ArrowLeft } from '@element-plus/icons-vue'

const router = useRouter()

const goHome = () => {
  router.push('/')
}

const goBack = () => {
  router.go(-1)
}
</script>


<template>
  <div class="not-found-container">
    <div class="not-found-content">
      <div class="error-image">
        <img src="@/assets/images/page404.png" alt="404 Error" class="error-img" />
      </div>

      <div class="error-info">
        <h1 class="error-title">页面走丢了</h1>
        <p class="error-description">
          抱歉，您访问的页面不存在或已被移除
        </p>
        <p class="error-code">错误代码: 404</p>

        <div class="error-actions">
          <el-button type="primary" size="large" @click="goHome">
            <el-icon><House /></el-icon>
            返回首页
          </el-button>
          <el-button size="large" @click="goBack">
            <el-icon><ArrowLeft /></el-icon>
            返回上页
          </el-button>
        </div>
      </div>
    </div>

    <!-- 装饰性元素 -->
    <div class="floating-elements">
      <div class="floating-circle circle-1"></div>
      <div class="floating-circle circle-2"></div>
      <div class="floating-circle circle-3"></div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.not-found-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
  padding: 20px;

  .not-found-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    z-index: 2;
    position: relative;

    @media (max-width: 768px) {
      flex-direction: column;
      padding: 40px 20px;
      text-align: center;
    }
  }

  .error-image {
    flex: 1;
    max-width: 500px;
    margin-right: 60px;

    @media (max-width: 768px) {
      margin-right: 0;
      margin-bottom: 40px;
    }

    .error-img {
      width: 100%;
      height: auto;
      max-width: 400px;
      filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.1));
      animation: float 6s ease-in-out infinite;
    }
  }

  .error-info {
    flex: 1;
    max-width: 500px;

    .error-title {
      font-size: 3.5rem;
      font-weight: 700;
      color: #2c3e50;
      margin: 0 0 20px 0;
      background: linear-gradient(135deg, #667eea, #764ba2);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;

      @media (max-width: 768px) {
        font-size: 2.5rem;
      }
    }

    .error-description {
      font-size: 1.2rem;
      color: #5a6c7d;
      line-height: 1.6;
      margin: 0 0 15px 0;
    }

    .error-code {
      font-size: 1rem;
      color: #8492a6;
      margin: 0 0 40px 0;
      font-family: 'Courier New', monospace;
    }

    .error-actions {
      display: flex;
      gap: 15px;
      flex-wrap: wrap;

      @media (max-width: 480px) {
        flex-direction: column;

        .el-button {
          width: 100%;
        }
      }

      .el-button {
        border-radius: 12px;
        padding: 12px 24px;
        font-weight: 600;
        transition: all 0.3s ease;

        &:hover {
          transform: translateY(-2px);
          box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        }
      }
    }
  }

  // 装饰性浮动元素
  .floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;

    .floating-circle {
      position: absolute;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.1);
      animation: float-slow 8s ease-in-out infinite;

      &.circle-1 {
        width: 100px;
        height: 100px;
        top: 10%;
        left: 10%;
        animation-delay: 0s;
      }

      &.circle-2 {
        width: 150px;
        height: 150px;
        top: 60%;
        right: 10%;
        animation-delay: 2s;
      }

      &.circle-3 {
        width: 80px;
        height: 80px;
        bottom: 15%;
        left: 15%;
        animation-delay: 4s;
      }
    }
  }
}

// 动画效果
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes float-slow {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-30px) rotate(180deg);
  }
}

// Element Plus 按钮样式覆盖
:deep(.el-button) {
  .el-icon {
    margin-right: 6px;
  }
}
</style>
